<template>
	<view class="container">
		<!-- 顶部导航栏 -->
		<u-navbar
			title="合同签约"
			:autoBack="true"
			:fixed="true"
			:bgColor="'#ffffff'"
			:placeholder="true"
			:titleStyle="{
				color: '#333',
				fontSize: '16px',
			}"
		>
			<template #right>
				<text class="nav-right">电子合同</text>
			</template>
		</u-navbar>

		<!-- 表单内容 -->
		<view class="form-content">
			<!-- 租期信息 -->
			<view class="section-title">租期信息</view>
			<view class="form-section">
				<view class="form-item">
					<text class="label required">租期开始时间</text>
					<text class="value">2025-10-10</text>
				</view>
				<view class="form-item">
					<text class="label required">租期截止时间</text>
					<text class="value">2025-10-10</text>
				</view>
			</view>

			<!-- 租金与押金 -->
			<view class="section-title">租金与押金</view>
			<view class="form-section">
				<view class="form-item">
					<text class="label required">租金</text>
					<view class="value">
						<text>2000元/月</text>
					</view>
				</view>
				<view class="form-item">
					<text class="label required">支付日期</text>
					<view class="value">
						<text>每月1日</text>
						<u-icon name="arrow-right" color="#999" size="16"></u-icon>
					</view>
				</view>
				<view class="form-item">
					<text class="label required">押金</text>
					<view class="value">
						<text>2000元</text>
					</view>
				</view>
				<view class="form-item">
					<text class="label required">电费</text>
					<view class="value">
						<text>1元/度</text>
					</view>
				</view>
				<view class="form-item">
					<text class="label required">水费</text>
					<view class="value">
						<text>0.3元/升</text>
					</view>
				</view>
			</view>

			<!-- 附加条件 -->
			<view class="section-title">附加条件</view>
			<view class="form-section">
				<view class="textarea-box">
					<textarea v-model="form.additionalTerms" placeholder="请输入附加条件" placeholder-style="color: #999"></textarea>
				</view>
			</view>

			<!-- 合同附件 -->
			<view class="form-section">
				<view class="attachment-header">
					<text class="section-title" style="margin-bottom: 0">合同附件</text>
					<view class="upload-btn">
						<u-icon name="attach" color="#0095f8" size="20"></u-icon>
					</view>
				</view>
			</view>
		</view>

		<!-- 底部按钮组 -->
		<view class="bottom-btns">
			<view class="btn prev" @click="handlePrev">上一步</view>
			<view class="btn next" @click="handleNext">下一步</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			form: {
				additionalTerms: "",
			},
		};
	},
	methods: {
		handlePrev() {
			uni.navigateBack();
		},
		handleNext() {
			uni.navigateTo({
				url: '/pages-lease/contract/contract-sign'
			});
		}
	}
};
</script>

<style lang="less" scoped>
.container {
	min-height: 100vh;
	background: #f5f6fa;
}

.nav-right {
	font-size: 28rpx;
	color: #2979ff;
	padding: 0 32rpx;
}

.form-content {
	padding: 0 24rpx;

	.section-title {
		font-size: 28rpx;
		color: #333;
		margin-bottom: 24rpx;
	}
}

.form-section {
	background: #fff;
	border-radius: 12rpx;
	padding: 0 24rpx;
	margin-bottom: 24rpx;

	.form-item {
		display: flex;
		align-items: center;
		justify-content: space-between;
		min-height: 88rpx;
		border-bottom: 2rpx solid #f5f5f5;

		&:last-child {
			border-bottom: none;
		}

		.label {
			font-size: 28rpx;
			color: rgba(102, 102, 102, 1);

			&.required::after {
				content: "*";
				color: #ff5a5f;
				margin-left: 4rpx;
			}
		}

		.value {
			display: flex;
			align-items: center;
			font-size: 28rpx;
			color: rgba(34, 34, 34, 1);
			text-align: right;

			.unit {
				font-size: 24rpx;
				color: #999;
				margin-left: 4rpx;
			}
		}
	}

	.textarea-box {
		textarea {
			width: 100%;
			height: 160rpx;
			font-size: 28rpx;
			padding: 20rpx;
		}
	}

	.attachment-header {
		padding: 24rpx 0;
		display: flex;
		justify-content: space-between;
		align-items: center;

		.upload-btn {
			width: 64rpx;
			height: 64rpx;
			display: flex;
			align-items: center;
			justify-content: center;
            background: #2979ff1a;
			border-radius: 10rpx;
		}
	}
}

.bottom-btns {
	padding: 24rpx;
	display: flex;
	justify-content: space-between;
	padding-bottom: calc(24rpx + env(safe-area-inset-bottom));

	.btn {
		width: 336rpx;
		height: 88rpx;
		line-height: 88rpx;
		text-align: center;
		border-radius: 44rpx;
		font-size: 32rpx;

		&.prev {
			color: #2979ff;
			background: #fff;
			border: 2rpx solid #2979ff;
		}

		&.next {
			color: #fff;
			background: #2979ff;
		}
	}
}
</style>
